package cn.tedu.luban.settle.main.repository;

import cn.tedu.luban.settle.main.converter.SettleConverter;
import cn.tedu.luban.settle.main.mapper.SettleMapper;
import cn.tedu.luban.settle.protocol.dos.SettleBillDO;
import cn.tedu.luban.settle.protocol.param.SettleBillParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class SettleRepoImpl implements SettleRepository{
    @Autowired
    private SettleMapper settleMapper;
    @Override
    public Long countSettleBillByOrderNo(String orderNo) {
        //select count(*) from settle_bill where order_no=#{orderNo}
        return settleMapper.countSettleBillByOrderNo(orderNo);
    }
    @Autowired
    private SettleConverter settleConverter;
    @Override
    public void batchSave(List<SettleBillParam> params) {
        List<SettleBillDO> dos = settleConverter.params2dos(params);
        settleMapper.batchInsert(dos);
        //insert into settle_bill (字段) values (师傅数据),(平台数据)
        //insert into settle_bill (字段) values (师傅数据);insert into settle_bill (字段) values (平台数据)
    }
}
